package com.security.wxlogin.api;

import lombok.extern.slf4j.Slf4j;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

/**
 * @Classname WXLoginApi
 * @Description 微信登录
 * @Date 2020/4/21 0021 12:17
 * @Created by 埔枘
 */
@Slf4j
@Controller
public class WXLoginApi {

    @GetMapping(value = {"index","/"})
    public String index(@AuthenticationPrincipal UsernamePasswordAuthenticationToken userAuthentication, Model model){
        model.addAttribute("user",userAuthentication.getPrincipal());
        log.info("{}",userAuthentication);
        return "index";
    }
    @GetMapping(value = {"login"})

    public String login(){
        return "login";
    }

    @GetMapping(value = "wxLogin")
    public String wxLogin(){
        return "wxLogin";
    }






}
